package com.xsr.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xsr.mapper.ProfileMapper;
import com.xsr.pojo.Profile;
import com.xsr.service.ProfileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 邢式瑞
 * @version 1.0
 * @project peopleThing
 * @date 2022/9/11 17:55
 */
@Service
public class ProfileServiceImpl implements ProfileService {
    @Autowired
    private ProfileMapper profileMapper;
    @Override
    public PageInfo<Profile> selectAll(int pn, int ps) {
        PageHelper pageHelper = new PageHelper();
        pageHelper.startPage(pn,ps);
        List<Profile> profileList = profileMapper.selectAll();

        PageInfo<Profile> profilePageInfo = new PageInfo<>(profileList);
        return profilePageInfo;
    }

    @Override
    public Profile selectById(Integer id) {
        return profileMapper.selectById(id);
    }

    @Override
    public void update(Profile profile) {
         profileMapper.update(profile);
    }
}
